﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI.DataVisualization.Charting;


namespace WebSite.admin.Report
{
    public partial class Test : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            FillData();

            Chart1.Series["Series1"].ChartType = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), "FastLine");
            Chart1.Series["Series2"].ChartType = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), "FastLine");
            Chart1.Series["Series3"].ChartType = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), "FastLine");
        }

        private void FillData()
        {
            // Fill series data
            double yValue = 50.0;
            double yValue2 = 50.0;
            double yValue3 = 50.0;
            //if (Chart1.Series["Series1"].Points.Count > 0)
            //{
            //    yValue = Chart1.Series["Series1"].Points[Chart1.Series["Series1"].Points.Count - 1].YValues[0];
            //    yValue2 = Chart1.Series["Series2"].Points[Chart1.Series["Series1"].Points.Count - 1].YValues[0];
            //    yValue3 = Chart1.Series["Series3"].Points[Chart1.Series["Series1"].Points.Count - 1].YValues[0];
            //}
            Random random = new Random();
            for (int pointIndex = 0; pointIndex < 20000; pointIndex++)
            {
                yValue = yValue + (float)(random.NextDouble() * 10.0 - 5.0);
                Chart1.Series["Series1"].Points.AddY(yValue);

                yValue2 = yValue2 + (float)(random.NextDouble() * 10.0 - 5.0);
                Chart1.Series["Series2"].Points.AddY(yValue2);

                yValue3 = yValue3 + (float)(random.NextDouble() * 10.0 - 5.0);
                Chart1.Series["Series3"].Points.AddY(yValue3);
            }
        }
    }
}